"ui";
//  8pro   17替换 成  <com.stardust.autojs.core.console.GlobalConsole id="console" h="*" w="*" />
//  免费版本   17替换 成  <com.stardust.autojs.core.console.ConsoleView id="console" h="*" w="*" />
//本代码免费版测试
ui.layout(
    <frame>
        
        <vertical>//垂直布局
            <card alpha="0.5" gravity="center_vertical">
                <text size ="25" gravity="center" >123</text>
                </card>
                <card alpha="0.5">
                <horizontal>//水平布局
                    <button id = "ks" gravity="center" size="18" text="开始" w="120" h="50"/>
                    
                </horizontal>
            </card>
            <card h="300" alpha="0.5" >
           <com.stardust.autojs.core.console.ConsoleView id="console" h="*" w="*" />

                
            </card>           
            <frame>
                <linear >
                    <TextView
                    android:id="tv_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:ellipsize="marquee"
                    android:focusable="true"
                    android:focusableInTouchMode="true"
                    android:marqueeRepeatLimit="marquee_forever"
                    android:singleLine="true"
                    android:textSize="10sp"
                    android:textColor="#ff010100"
                    android:scrollHorizontally="true"/>
                </linear>
            </frame>
        </vertical>
    </frame>
);
ui.console.setConsole(runtime.console);
// 设置控制台字体颜色
let c = new android.util.SparseArray();
let Log = android.util.Log;
c.put(Log.VERBOSE, new java.lang.Integer(colors.parseColor("#dfc0c0c0")));//黑色
c.put(Log.INFO, new java.lang.Integer(colors.parseColor("#ff64dd17")));//绿色
c.put(Log.WARN, new java.lang.Integer(colors.parseColor("#ff2962ff")));//蓝色
c.put(Log.ERROR, new java.lang.Integer(colors.parseColor("#ffd50000")));//红色
ui.console.setColors(c);



ui.ks.on("click", () => {
    threads.start(function() {
            while (true) {
            
            
                sleep(100);
                console.verbose("你好");
                sleep(100);
                console.info("你好");
                sleep(100);
                console.warn("你好");
                sleep(100);
                console.error("你好");
                sleep(100);
               
                
               
        }
    });
});





